package com.arithmetic.version2;

import org.junit.Test;
import static org.junit.Assert.*;

public class BinaryOperationTester {

    @Test
    public void testAdditionOperation() {
        BinaryOperation bop = new AdditionOperation(5, 3);
        assertEquals(8, bop.calculate());
        assertTrue(bop.checkingCalculation(8));
        assertFalse(bop.checkingCalculation(9));
        assertEquals('+', bop.getOperator());
    }

    @Test
    public void testSubstractOperation() {
        BinaryOperation bop = new SubstractOperation(5, 3);
        assertEquals(2, bop.calculate());
        assertTrue(bop.checkingCalculation(2));
        assertFalse(bop.checkingCalculation(3));
        assertEquals('-', bop.getOperator());
    }

    @Test
    public void testGenerateOperation() {
        BinaryOperation addOp = BinaryOperation.generateOperation('+');
        assertEquals('+', addOp.getOperator());

        BinaryOperation subOp = BinaryOperation.generateOperation('-');
        assertEquals('-', subOp.getOperator());
    }
}